import request from '@/config/axios'

// 客户档案 VO
export interface CustomerVO {
  id: number // 主键id
  code: string // 编码
  name: string // 名称
  addr: string // 地址
  categoryId: number // 分类编码
}

// 客户档案 API
export const CustomerApi = {
  // 查询客户档案分页
  getCustomerPage: async (params: any) => {
    return await request.get({ url: `/wms/customer/page`, params })
  },

  // 查询业务员简单列表
  getCustomerList: async () => {
    return await request.get({ url: `/wms/customer/simple-list` })
  },

  // 查询客户档案详情
  getCustomer: async (id: number) => {
    return await request.get({ url: `/wms/customer/get?id=` + id })
  },

  // 新增客户档案
  createCustomer: async (data: CustomerVO) => {
    return await request.post({ url: `/wms/customer/create`, data })
  },

  // 修改客户档案
  updateCustomer: async (data: CustomerVO) => {
    return await request.put({ url: `/wms/customer/update`, data })
  },

  // 删除客户档案
  deleteCustomer: async (id: number) => {
    return await request.delete({ url: `/wms/customer/delete?id=` + id })
  },

  // 导出客户档案 Excel
  exportCustomer: async (params) => {
    return await request.download({ url: `/wms/customer/export-excel`, params })
  },
}
